package com.ilibrary.web.action;

import javax.servlet.http.HttpServletRequest;

import com.ilibrary.base.MyBaseAction;
import com.ilibrary.service.BookService;
import com.ilibrary.web.dto.ResultDto;
import com.ilibrary.web.vo.BookVO;

public class BookItemAction extends MyBaseAction {
	
	private BookService bookService;
	
	public BookService getBookService() {
		return bookService;
	}
	public void setBookService(BookService bookService) {
		this.bookService = bookService;
	}

	@Override
	public String execute() throws Exception {
		HttpServletRequest request = getRQ();
		String bookId = request.getParameter("bookId");
		ResultDto<BookVO> resultDto = bookService.findById(Integer.parseInt(bookId));
		BookVO bookVO = resultDto.getFirstResult();
		request.setAttribute("bookVO", bookVO);
		return SUCCESS;
	}
}
